#include<thread>
#include<iostream>

class A
{
public:
	A(void) { std::cout << "A constructor.\n"; }
	~A(void) { std::cout << "A Destructor.\n"; }
	void Print(void) { std::cout << " A Print " << v << std::endl; }
	int v = 100;
};

/*
输出结果:
A Print 200
A Print 100

如果删掉thread_local属性，则输出结果是：
A Print 200
A Print 200
*/
int main(void)
{
	thread_local A ca;

	std::thread([&](void) {
		ca.v = 200;
		ca.Print();
	}).join();

	ca.Print();
}
